package com.example.lanou.mynews.thread;

import android.os.Handler;
import android.util.Log;

/**
 * Created by dllo on 16/1/15.
 */
public class HeadViewThread extends Thread {
    private  Handler handler;
    private boolean flag = true;

    /***
     *  what is 0,for changing my headview
     * @param handler
     */
  public HeadViewThread (Handler handler){
      this.handler = handler;
  }
    public void setFlag(boolean flag){
        this.flag = flag;
    }
    public void run() {
        try {
            while (flag){
                Thread.sleep(2500);
                if(flag)
                handler.sendEmptyMessage(0);
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
